<?php
/**
 * Created by PhpStorm.
 * User: Fight.节奏
 * Date: 2016/8/2
 * Time: 21:07
 */
$arcModel=new \Common\Model\Arc();
$cateModel=new \Common\Model\Cate();
//        获得所有的分类数据
$cateData=$cateModel->get();
foreach($cateData as $k=>$u){
//            select count(*) from arcitle where category_cid={$u['cid']}
    $cateData[$k]['total']=$arcModel->where("category_cid={$u['cid']}")->where("is_recycle=0")->count();
}
//p($cateData);exit;
$tagModel=new Common\Model\Tag();
$arctagModel=new Common\Model\Arctag();
$tagData=$tagModel->get();
foreach($tagData as $k=>$v){
    $tagData[$k]['total']=$arctagModel->join('article','article_aid','=','aid')->where("tag_tid={$v['tid']}")->where("is_recycle=0")->count();
}
//p($tagData);exit;
?>
<aside class="col-md-4 hidden-sm hidden-xs">
    <div class="_widget">
        <h4>关于自己</h4>
        <div class="_info">
            <p>多年一线开发经验与讲师经验。擅长引导思维，而不是一味灌输，新生代优秀青年的代表...</p>
            <p>
                <i class="glyphicon glyphicon-volume-down"></i>
                目前就职于
                <a href="http://www.baidu.com" target="_blank">百度</a>
            </p>
        </div>
    </div>
    <div class="_widget">
        <h4>分类列表</h4>
        <div>
            <?php foreach ($cateData as $v){?>
            <a href="c_<?php echo $v['cid']?>.html"><?php echo $v['cname']?>(<?php echo $v['total']?>)</a>
            <?php }?>
        </div>
    </div>
    <div class="_widget">
        <h4>标签云</h4>
        <div class="_tag">
            <?php foreach ($tagData as $u){?>
            <a href="t_<?php echo $u['tid']?>.html"><?php echo $u['tname']?><?php echo $u['total']?></a>
            <?php }?>
        </div>
    </div>

</aside>
